package campus.controller;

import campus.model.Account;
import campus.model.AccountExample;
import campus.model.CredentialsLog;
import campus.service.AccountBookService;
import campus.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author ：wang
 * @description：财簿
 * @date ：2020/5/10 14:40
 */
@RestController
@CrossOrigin
@RequestMapping("accountBook")
public class AccountBookController {
    @Autowired
    private AccountBookService accountBookService;
    /*
     * @Author: wang
     * @Description:分页模糊
     * @Date: 14:58 2020/5/10
     * @param: account 模糊对象
     * @param: pageNum 当前页
     * @param: pageSize 每页多少条
     * @return: campus.util.PageResult
     */
    @RequestMapping(value = "findByAllPageSize/{pageNum}/{pageSize}",method = RequestMethod.POST)
    public PageResult findByAllPageSize(@RequestBody CredentialsLog credentialsLog, @PathVariable("pageNum") int pageNum , @PathVariable("pageSize") int pageSize){
        PageResult findallpage = accountBookService.findByAllPageSize(credentialsLog,pageNum, pageSize);
        return findallpage;
    }

    /*
     * @Author: wang
     * @Description:查询
     * @Date: 16:50 2020/5/10
     * @param:
     * @return: java.util.List<campus.model.Account>
     */
    @RequestMapping(value = "/selectAllkm",method = RequestMethod.GET)
    public List<Account> selectAllkm() {
        return accountBookService.selectAllkm();
    }
    /*
     * @Author: wang
     * @Description:分页模糊查询总账
     * @Date: 14:58 2020/5/10
     * @param: account 模糊对象
     * @param: pageNum 当前页
     * @param: pageSize 每页多少条
     * @return: campus.util.PageResult
     */
    @RequestMapping(value = "selectAllzz/{pageNum}/{pageSize}",method = RequestMethod.POST)
    public Map selectAllzz(@RequestBody CredentialsLog credentialsLog, @PathVariable("pageNum") int pageNum , @PathVariable("pageSize") int pageSize){
        Map map = accountBookService.selectAllzz(credentialsLog, pageNum, pageSize);
        return map;
    }
    @RequestMapping(value = "selectAllkmye/{pageNum}/{pageSize}",method = RequestMethod.POST)
    public Map selectAllkmye(@RequestBody CredentialsLog credentialsLog, @PathVariable("pageNum") int pageNum , @PathVariable("pageSize") int pageSize){
        Map map = accountBookService.selectAllkmye(credentialsLog, pageNum, pageSize);
        return map;
    }
}
